namespace cnVery.Cms.UI
{
    using cnVery.Cms.Kernel;
    using cnVery.Controls;
    using System;
    using System.Web.UI.WebControls;

    public class Bulletins : UI_Main
    {
        protected Repeater more;
        protected Pager pager;

        private void Bind()
        {
            string str = " visible = 1 ";
            this.pager.Total = (int) base.conn.GetScalar("select count(1) from bulletins where " + str);
            this.pager.Calculate();
            string sql = string.Concat(new object[] { "select top ", this.pager.Per, " * from bulletins where ", str });
            if (this.pager.CurrentPage > 1)
            {
                object obj2 = sql;
                sql = string.Concat(new object[] { obj2, " and id < (select min(id) from (select top ", this.pager.Per * (this.pager.CurrentPage - 1), " id from bulletins where ", str, " order by id desc) as tb)" });
            }
            sql = sql + " order by id desc ";
            this.more.DataSource = base.conn.GetDataTable(sql);
            this.more.DataBind();
        }

        private void InitializeComponent()
        {
            base.Load += new EventHandler(this.Page_Load);
        }

        protected override void OnInit(EventArgs e)
        {
            this.InitializeComponent();
            base.OnInit(e);
        }

        private void Page_Load(object sender, EventArgs e)
        {
            this.Bind();
            this.Finish();
        }
    }
}

